package com.zhuiyun.pm.sys.bidmanagement.controller;


import com.zhuiyun.pm.page.PageRequest;
import com.zhuiyun.pm.page.PageResult;
import com.zhuiyun.pm.result.CommonResult;
import com.zhuiyun.pm.sys.bidmanagement.entity.GoodsInfo;
import com.zhuiyun.pm.sys.bidmanagement.service.GoodsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName PublishController
 * @Description TODO
 * @Author yb
 * @Date 2023/3/13 21:02
 **/
@RequestMapping("/GoodsInfo")
@CrossOrigin
@RestController
public class GoodsInfoController {
    @Autowired
    public GoodsInfoService goodsInfoService;
    /**
        * @Author yuanb
        * @Description
        * @Date 2023/3/14 9:04
        * @Return com.zhuiyun.pm.result.CommonResult
        * @param pageRequest
        * 竞拍管理全查
    */
    @GetMapping("/goodsInfoSelectAll")
    public CommonResult  goodsInfoSelectAll(GoodsInfo goodsInfo , PageRequest pageRequest){
        PageResult pageResult = goodsInfoService.goodsInfoSelectAll(goodsInfo, pageRequest);
        return CommonResult.ok(pageResult);
    }
    /**
        * @Author yuanb
        * @Description
        * @Date 2023/3/15 8:36
        * @Return com.zhuiyun.pm.result.CommonResult
        * @param id
        * 修改审核成功
    */
    @GetMapping("/goodsInfoUpdatePass")
    public CommonResult goodsInfoUpdatePass(Integer id){
        if(id !=null && id != 0){
           int i=  goodsInfoService.goodsInfoUpdatePass(id);
           return CommonResult.ok(i);
        }else {
            return CommonResult.error("id为空");
        }
    }
    /**
     * @Author yuanb
     * @Description
     * @Date 2023/3/15 8:36
     * @Return com.zhuiyun.pm.result.CommonResult
     * @param id
     * 修改驳回
     */
    @GetMapping("/goodsInfoUpdateReject")
    public CommonResult goodsInfoUpdateReject(Integer id){
        if(id !=null && id != 0){
            int i=  goodsInfoService.goodsInfoUpdateReject(id);
            return CommonResult.ok(i);
        }else {
            return CommonResult.error("id为空");
        }
    }
    /**
     * @Author yuanb
     * @Description
     * @Date 2023/3/15 8:36
     * @Return com.zhuiyun.pm.result.CommonResult
     * @param id
     * 修改二次审核成功
     */
    @GetMapping("/goodsInfoUpdateSecondary")
    public CommonResult goodsInfoUpdateSecondary(Integer id){
        if(id !=null && id != 0){
            int i=  goodsInfoService.goodsInfoUpdateSecondary(id);
            return CommonResult.ok(i);
        }else {
            return CommonResult.error("id为空");
        }
    }
    /**
     * @Author yuanb
     * @Description
     * @Date 2023/3/15 8:36
     * @Return com.zhuiyun.pm.result.CommonResult
     * @param id
     * 修改二次驳回
     */
    @GetMapping("/goodsInfoUpdateRejectSecondary")
    public CommonResult goodsInfoUpdateRejectSecondary(Integer id){
        if(id !=null && id != 0){
            int i=  goodsInfoService.goodsInfoUpdateRejectSecondary(id);
            return CommonResult.ok(i);
        }else {
            return CommonResult.error("id为空");
        }
    }
    /**
        * @Author yuanb
        * @Description
        * @Date 2023/4/1 9:30
        * @Return com.zhuiyun.pm.result.CommonResult
        * * @param goodsInfo
     * 竞品跟踪
    */
    @GetMapping("/goodsInfoFollow")
    public CommonResult  goodsInfoFollow(GoodsInfo goodsInfo , PageRequest pageRequest){
        PageResult pageResult = goodsInfoService.goodsInfoFollow(goodsInfo, pageRequest);
        return CommonResult.ok(pageResult);
    }
    /**
     * @Author yuanb
     * @Description
     * @Date 2023/3/15 8:36
     * @Return com.zhuiyun.pm.result.CommonResult
     * @param id
     * 竞品下架
     */
    @GetMapping("/goodsInfoUndercarriage")
    public CommonResult goodsInfoUndercarriage(Integer id){
        if(id !=null && id != 0){
            int i=  goodsInfoService.goodsInfoUndercarriage(id);
            return CommonResult.ok(i);
        }else {
            return CommonResult.error("id为空");
        }
    }
}
